package ManagerSystem;

import java.util.Scanner;

import tjut.db.DBDriverFactory;

/**
 * 修改信息
 * @author ChrisL
 *
 */
public class ModifyInfo {

	public void ModifyStu(){
		SearchInfo si=new SearchInfo();
		si.SearchStu();
		System.out.println("*************************************");
		Scanner input=new Scanner(System.in);
		System.out.println("请输入你要修改的学生ID：");
		String Stuid=input.next();
		System.out.println("请输入修改后的姓名:");
		String Stuname=input.next();
		System.out.println("请输入修改后的性别:");
		String Stusex=input.next();
		System.out.println("请输入修改后的年龄:");
		String Stuage=input.next();
		System.out.println("请输入修改后的电话:");
		String Stuphone=input.next();
		System.out.println("请输入修改后的地址:");
		String Stuadd=input.next();
		System.out.println("请输入修改后的密码:");
		String Stupsw=input.next();
		String strSQL = "update MANAGERSYS set STU_NAME='"+Stuname+"',STU_SEX='"+Stusex+"',STU_AGE='"+Stuage+"',STU_PHONE='"+Stuphone+"',STU_ADDRESS='"+Stuadd+"',STU_PSW='"+Stupsw+ "'where STU_ID=?";
		int i =  DBDriverFactory.getDBDriverInstance().update(strSQL,new Object[] {Stuid});
		System.out.println(i>0?"修改成功":"修改失败");
	}
	
	public void ModifyMe(String UserStu){
		Scanner input=new Scanner(System.in);
		System.out.println("请输入修改后的密码:");
		String Stupsw=input.next();
		String strSQL1 = "update MANAGERSYS set STU_PSW='"+Stupsw+ "'where STU_ID=?";
		int i =  DBDriverFactory.getDBDriverInstance().update(strSQL1,new Object[] {UserStu});
		System.out.println(i>0?"修改成功,请牢记你的新密码!":"修改失败");
		
	}
}
